package com.springcloud.test;

import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.messaging.Source;
import org.springframework.context.annotation.Bean;
import org.springframework.integration.annotation.InboundChannelAdapter;
import org.springframework.integration.annotation.Poller;
import org.springframework.integration.core.MessageSource;
import org.springframework.messaging.support.GenericMessage;


/**
 * @Desc: 生产者
 * ----------------
 * @CLASS_NAME: SinkReceiver
 * ----------------
 * @Author: jovi
 * ----------------
 * @Date: 2020-03-27 17:00
 */
@Slf4j
@EnableBinding({Source.class})
public class SinkSender {


    @Bean
    @InboundChannelAdapter(value = Source.OUTPUT, poller = @Poller(fixedDelay = "2000"))
    public MessageSource<String> timerMessageSource() {
        return () -> new GenericMessage<>("{\"name\":\"Mars\",\"age\":30}");
    }
}
